package cn.wonderland.system.service.impl;

import cn.wonderland.basic.service.impl.BaseServiceImpl;
import cn.wonderland.system.domain.Detail;
import cn.wonderland.system.domain.Type;
import cn.wonderland.system.mapper.DetailMapper;
import cn.wonderland.system.mapper.TypeMapper;
import cn.wonderland.system.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl extends BaseServiceImpl<Type> implements TypeService {

    @Autowired
    private TypeMapper typeMapper;

    @Autowired
    private DetailMapper detailMapper;

    @Override
    public void delete(Long id) {
        // 删除字典类型
        typeMapper.delete(id);
        // 同时根据字典类型id删除部门
        detailMapper.deleteByTypesId(id);
    }


    @Override
    public List<Detail> findHouseType() {
        return typeMapper.findHouseType();
    }
}
